package com.sob.bountyhunter.hud;


import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.SpriteSheet;

import com.sob.bountyhunter.Mapa;

public class ContadorVidas {	
	
	public int vidas=0;
	public int maxVidas=0;
	private SpriteSheet plantilla;
	
	public ContadorVidas(int v) throws SlickException{
		plantilla=new SpriteSheet("/res/hearts.png", 32, 32,  new Color(0xFF00FF));
		vidas=v;
		maxVidas=v;
	}
	
	public void update(GameContainer gameContainer, int deltaTime, Mapa map)
	{
		
	}
	
	public void render(int x, int y)
	{		
		int enteros=vidas/2;
		int resto=vidas%2;
		
		for(int i=0; i<maxVidas/2;i++){
			Image img=null;
			
			img=plantilla.getSprite(2, 0);								
			
			img.draw(x+(i*35), y);
		}
		
		for(int i=0; i<enteros;i++){
			Image img=null;
			
			img=plantilla.getSprite(0, 0);								
			
			img.draw(x+(i*35), y);
		}

		if(resto>0){
			Image img=null;
			
			img=plantilla.getSprite(1, 0);								
			
			img.draw(x+(enteros*35), y);			
		}

	}
	
}
